﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using DAL.Repositories;

namespace BLL
{
    public class UserCTR : Interfaces.IUserCTR
    {
        UserRepository _userRep;

        public UserCTR()
        {
            _userRep = new UserRepository();
        }

        /// <summary>
        /// Get a customer by phone number
        /// </summary>
        /// <param name="phoneNo">Phone number of customer</param>
        /// <returns>Customer with phone number</returns>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="InvalidOperationException"></exception>
        /// <exception cref="Exception"></exception>
        public User GetCustomer(string phoneNo)
        {
            return _userRep.GetCustomer(phoneNo);
        }

        /// <summary>
        /// Checks if Employee with initials is authorized
        /// </summary>
        /// <param name="initials">initials of Employee</param>
        /// <returns>true if Employee is authorized</returns>
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="Exception"></exception>
        public bool IsEmployeeAuthorized(string initials)
        {
            return _userRep.IsEmployeeAuthorized(initials);
        }
    }
}